# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Josip Ponjavic <josipponjavic at gmail dot com>
# Contributor: Xu Fasheng <fasheng.xu[AT]gmail.com>

pkgname=deepin-session-shell
pkgver=5.5.84
pkgrel=1
pkgdesc='Deepin desktop-environment - session-shell module'
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/dde-session-shell"
license=('GPL3')
# qt5-tools: for qdbus executable
depends=('deepin-daemon' 'deepin-network-core' 'deepin-qt5integration' 'deepin-wallpapers'
         'gsettings-qt' 'liblightdm-qt5' 'lightdm' 'qt5-tools' 'startdde' 'kwayland')
makedepends=('cmake' 'gmock' 'gtest' 'ninja')
conflicts=('deepin-session-ui<5')
provides=('lightdm-deepin-greeter')
groups=('deepin')
source=("https://github.com/linuxdeepin/dde-session-shell/archive/$pkgver/$pkgname-$pkgver.tar.gz"
        fix-dtk-linking.patch)
sha512sums=('3292f6e6ba05615bf2c40dbd418ad0f0228307df1f00651d5df21b8130c9fb5fbca5e9c84a9f6370430dc2dbd6b1760c99802eef0f961f0bc2b4c797da8f879d'
            '77265da51f5c8eb55589d0ba11fa4e216404b821bd95126669b0bc4ad7c47e06711e1ad4637a0ed58f45553a837e2d582341c66fb17ba026ef0bd1d6af09b765')

prepare() {
  cd dde-session-shell-$pkgver
  patch -p1 -i ../fix-dtk-linking.patch
  # We don't have common-auth on Arch
  sed -i 's/common-auth/system-login/' src/libdde-auth/deepinauthframework.cpp
}

build() {
  cd dde-session-shell-$pkgver
  cmake . -GNinja -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_SYSCONFDIR=/etc
  ninja
}

package() {
  cd dde-session-shell-$pkgver
  DESTDIR="$pkgdir" ninja install

  chmod +x "$pkgdir"/usr/bin/deepin-greeter
}
